{
PROB : hamming
LANG : PASCAL
}
program hamming;
const
  fi = 'hamming.in';
  fo = 'hamming.out';
type
  bin = record
          b : array[0..7] of byte;
          d : longint;
        end;
var
  n, b, d : longint;
  base2 : array[0..7] of longint;
  a : bin;
  stack : array[1..64] of bin;
  top : longint;

procedure inp;
var
  i : integer;
begin
  read(n, b, d);
  dec(b);
  for i := 0 to 7 do base2[i] := 1 shl i;
end;

function dis(x, y : bin) : longint;
var
  i, res : longint;
begin
  res := 0;
  for i := 0 to b do
    if x.b[i] <> y.b[i] then inc(res);
  dis := res;
end;

function ok : boolean;
var
  i : longint;
begin
  ok := false;
  for i := 1 to top do
    if dis(a, stack[i]) < d then exit;
  ok := true;
end;

procedure attemp(k, sum : longint);
begin
  if top = n then exit;

  if k = -1 then
  begin
    if ok then
    begin
      a.d := sum;
      inc(top);
      stack[top] := a;
    end;
    exit;
  end;

  a.b[k] := 0;
  attemp(k-1, sum);
  a.b[k] := 1;
  attemp(k-1, sum+base2[k]);
end;

procedure process;
begin
  top := 0;
  attemp(b, 0);
end;

procedure out;
var
  i, j : longint;
begin
  for i := 1 to top do
    if (i mod 10 = 0) or (i = top) then writeln(stack[i].d)
    else write(stack[i].d, ' ');
end;

begin
  assign(input, fi); reset(input);
  assign(output, fo); rewrite(output);

  inp;
  process;
  out;

  close(output);
  close(input);
end.
